/*
 * @Author: Eureka 
 * @Date: 2020-09-29 11:08:45 
 * @Last Modified by: Eureka
 * @Last Modified time: 2021-05-07 11:56:29
 */

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';
import 'package:senkoo_platform/Utils/is_empty.dart';

// ignore: must_be_immutable
class LoadSvg extends StatelessWidget {
  LoadSvg(
    this.svg, {
    Key? key,
    this.width = 16.0,
    this.height = 16.0,
    this.radius = 0,
    this.color,
    this.fullWidth = false,
    this.boxFit = BoxFit.cover,
    this.format = "svg",
    this.package,
  }) : super(key: key);

  final String? svg;
  final String format;
  final double width;
  final double height;
  final Color? color;
  bool fullWidth;
  final double radius;
  final BoxFit boxFit;
  final String? package;

  @override
  Widget build(BuildContext context) {
    if (EmptyUtil.isEmpty(svg) || svg == "null") {
      return Container();
    } else {
      return Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(radius.w),
        ),
        width: fullWidth ? ScreenUtil().screenWidth : width.w,
        height: height.h,
        child: SvgPicture.asset(
          svg!,
          color: color,
          fit: boxFit,
          package: package,
        ),
      );
    }
  }
}
